package com.ruoyi.web.controller.durian;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.durian.domain.LlInvoiceHistory;
import com.ruoyi.durian.service.LlInvoiceHistoryService;
import com.ruoyi.durian.service.LlOrderInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/invoice")
public class InvoiceController extends BaseController {
    @Resource
    LlInvoiceHistoryService llInvoiceHistoryService;

    @Resource
    LlOrderInfoService llOrderInfoService;

    /**
     * 发票历史
     * @param
     * @return
     */
    @GetMapping("/history/list")
    public TableDataInfo historyList() {
        startPage();
        return getDataTable(llInvoiceHistoryService.historyList());
    }

    /**
     * 可开发票列表
     * @param
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo invoiceList() {
        startPage();
        return getDataTable(llOrderInfoService.invoiceList());
    }

    /**
     * 保存发票
     * @param llInvoiceHistory
     * @return
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody LlInvoiceHistory llInvoiceHistory) {
        return llInvoiceHistoryService.saveInvoice(llInvoiceHistory);
    }

}
